package com.controller;

import com.bean.Bumen;
import com.service.BumenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/bumen")
public class BumenController {
    @Autowired
    private BumenService bumenService;
    @Autowired
    private Environment environment;

    @RequestMapping(path = "/addbumen", method = RequestMethod.GET)
    public boolean addBumen(@RequestBody Bumen bumen) {
        return bumenService.addBuMen(bumen);
    }

    @RequestMapping(path = "/list", method = RequestMethod.GET)
    public List<Bumen> getAll() {
        return bumenService.findAll();
    }

    @RequestMapping(path = "/getbumenbyid/{id}", method = RequestMethod.GET)
    public Bumen getBumenById(@PathVariable("id") Integer id) {
        return bumenService.findById(id);
    }

    @RequestMapping("/hello")
    public String sayhello(){
        return "dSDAFADSFAFSDFSD ";
    }

}
